package com.ansion.adapter;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;

import com.ansion.adapter.list.ITurboListItem;
import com.ansion.adapter.list.TurboListAdapter;

import java.util.Arrays;

class DemoItem implements ITurboItem<DemoItem.VH> {
    @Override
    public int getType() {
        return 0;
    }

    @Override
    public int getLayoutRes() {
        return 0;
    }

    @NonNull
    @Override
    public VH getViewHolder(View v) {
        return new VH(v);
    }

    class VH extends TurboAdapter.ViewHolder<Data> {

        public VH(View itemView) {
            super(itemView);
        }

        @Override
        public void bindView(Data item, int position) {

        }
    }


    class MainPage {
        public void init() {
            TurboAdapter<Data> adapter = TurboAdapter.with(Arrays.asList(new DemoItem(), new DemoItem()));
            // setadapter
//            adapter.setData().notifyItemChanged();


            TurboListAdapter.with(Arrays.asList(new TestIteem(), new TestIteem()), new DiffUtil.ItemCallback<Data>() {
                @Override
                public boolean areItemsTheSame(@NonNull Data data, @NonNull Data t1) {
                    return false;
                }

                @Override
                public boolean areContentsTheSame(@NonNull Data data, @NonNull Data t1) {
                    return false;
                }
            });

        }
    }

    class TestIteem implements ITurboListItem<Data, VML> {

        @Override
        public int getType() {
            return 0;
        }

        @Override
        public int getLayoutRes() {
            return 0;
        }

        @NonNull
        @Override
        public VML getViewHolder(View v) {
            return null;
        }
    }

    class VML extends TurboListAdapter.BaseViewHolder<Data> {

        public VML(View itemView) {
            super(itemView);
        }

        @Override
        public void bindView(Data item, int position) {

        }
    }

    class Data implements IAdapterData {

        @Override
        public int getType() {
            return 0;
        }
    }
}
